//
// Created by HP on 2024/1/31.
//

#ifndef AURORA_ST_AURORA_LABEL_H
#define AURORA_ST_AURORA_LABEL_H

#include "common_inc.h"

#include "lcd_driver.h"
#include "aurora_font.h"

class Aurora_Label{
public:
    typedef enum DISPLAY_MODE{
        style1 = 0,
        style2,
        style3,
        style4
    }DISPLAY_MODE;

public:
    Aurora_Label(LCD_Driver *lcd_driver = NULL,Aurora_Font *font_driver=NULL);

    void set_lcd_driver(LCD_Driver *lcd_driver);
    void set_font_driver(Aurora_Font *font_driver);

    void set_font_size(Aurora_Font::FONT_SIZE fsize);
    void set_hide(FunctionalState ENABLE);
    void set_pos(uint16_t x, uint16_t y);
    void set_text(const char *);
    void set_color(uint16_t color);
    void set_dtime(uint16_t dt);
    void set_display_mode(DISPLAY_MODE m);
    void set_select(uint8_t sel);
public:
    void show();

private:
    void _drawStr(uint16_t x,uint16_t y,uint16_t color,const char *str,uint8_t type,uint16_t dtime);
    void _drawfontData(uint16_t x,uint16_t y ,uint16_t color,const uint8_t *data,uint8_t type,uint16_t dtime,uint8_t part);

private:
    uint8_t  hide;  //是否显示
    uint16_t x,y;  //label的位置
    uint8_t  isSelect; //是否被选中
    uint16_t color;
    uint16_t dtime; //显示延时
    DISPLAY_MODE mode;
    char     text[100]; //文本
    Aurora_Font::FONT_SIZE font_size;
private:
    LCD_Driver *lcd;
    Aurora_Font *font;
};

#endif //AURORA_ST_AURORA_LABEL_H
